- Intro
- Insert
- Handle the indexing properly
For 1/0 based indexing use pos > 1/0 as condition and pos-- as statement
- Insertion make changes in 4 points
- Delete
current item is the one which should be removed
- After removing clear the removed memory.
- Reverse DLL
- If you want to use 2 variable, instead of 3, check and return then
tmp->prev variable after NULL checking.
current != NULL
- Use this when you want to process every node, including the last one.
- This loop ensures that even the last node is included.
- Essential when you are modifying pointers
current->next != NULL
- Use this when you only need to stop at the last node and don’t want to go past it.